package Thread;

/**
 * Created with IntelliJ IDEA.
 * Description: 多线程与线程等待
 */

public class ThreadDemo6 {
    public static void main(String[] args) {
        Thread t = null;
        for (int i = 0; i < 20; i++) {
            int tmp = i;
            t = new Thread(new Runnable() {
                @Override
                public void run() {
                    System.out.println(tmp);
                }
            });
            t.start();
        }

        try {
            t.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("ok");
    }
}
